package com.todo.strategy.pipeline.application.handler.planRelation;

import com.todo.strategy.pipeline.common.enums.OperateActionEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author azhebuxing
 * @date 2025/3/1 19:11
 * @description
 */
@Component
public class PlanRelationOperateFactory {

    @Autowired
    private List<AbstractPlanRelationOperateHandle> planRelationOperateHandles;

    public AbstractPlanRelationOperateHandle getStrategyActionHandle(OperateActionEnum operateActionEnum) {
        if (operateActionEnum == null) {
            return null;
        }
        for (AbstractPlanRelationOperateHandle operateHandle : planRelationOperateHandles) {
            if (operateActionEnum.equals(operateHandle.getStrategyActionEnum())) {
                return operateHandle;
            }
        }
        return null;
    }
}
